package com.ylxn.factory;

/**
 * 咖啡工厂
 */
public class CofferStore {
    //声明对象
    private Coffer coffer;
    public Coffer orderCoffer(String type){
        if ("american".equals(type)){
            coffer = new AmericanCoffer();
        }
        if ("latte".equals(type)){
            coffer = new LatteeCoffer();
        }
        else {
            throw new RuntimeException("无此咖啡");
        }
        //加配量
        coffer.addMike();
        coffer.addSugar();
        return coffer;
    }
}
